package cn.josh.action;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.josh.bean.Ec_article;
import cn.josh.service.Ec_articleService;
import cn.josh.servicelmpl.Ec_articleServiceImpl;


@WebServlet("/Article_InfoServlet")
public class Article_InfoServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{

		
		String id = request.getParameter("article_id");
		
		System.out.println("商品id是：" + id);
		
		//将商品id放入session中
		HttpSession session = request.getSession();
		session.setAttribute("articleId", id);
		
		Ec_articleService ec_as = new Ec_articleServiceImpl();
		Ec_article ec_a = ec_as.findById(id);
		
		request.setAttribute("article_info", ec_a);
		request.getRequestDispatcher("jsp/sp_info.jsp").forward(request, response);

	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		doGet(request, response);
	}

}
